<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ include file="/page/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/adapter/adapter-bootstrap.jsp" %>
</head>
<script type="text/javascript">
function deletefile(){
	if (templateId == ""||templatefile=="") {
		alert("请选择要删除的文件！");
	} else {
		if(p_del()){
		//Utils.forward(pageDeleteUrl);
		    $.ajax({
		        url:'${ctx}/template/deletefile?templateId='+templateId+'&templatefile='+templatefile,
		        type: "POST",      
		        dataType:"json",
		        async: false,
		        success: function(data) {
		        	if(data.flag>0){
			            alert("删除成功！");	
			            window.location.reload();
		        	}
		/* 	          $.each(data, function(index, element) {
		             window.location.reload();
		          }); */
		        },
		        error: function() {
		          alert("error");
		        }
		      });
		}
	}
}

function p_del() { 
	var msg = "您真的确定要删除吗？\n\n请确认！"; 
	if (confirm(msg)==true){ 
	return true; 
	}else{ 
	return false; 
	} 
} 


</script>
<body>
			<c:if test="${flag=='0'}">
			   <div class="op-btn">
				<input type="button" class="btn btn-default" value="添加模板文件"   onclick="Utils.forward('${ctx}/template/createfile?templateId=${templateId}');"/> 
				<input type="button" class="btn btn-default" value="删除模板文件"  onclick="deletefile();"/> 
			   </div>
			</c:if>
<macms:table dataListName="stfList">
	<macms:html id="ch" label="选择" innerHtml="<input type=\"radio\" name=\"check\" value=\"15\" onclick=\"Math_Click('${template_id}')\">"></macms:html>
	<macms:text id="template_id" label="模板标识"></macms:text>
	<macms:text id="file_type" label="文件类型" dictname="S_FILE_TYPE"></macms:text>
	<macms:text id="template_file" label="模板文件"></macms:text>
</macms:table>
	<script language="javascript">
	    var preRow = null;
	    var templateId="";
	    var templatefile="";
		$('tbody tr').bind('click', function() {
	
			var rowIndex = $(this).prevAll().length+1;
			if(rowIndex <1) return;
			
			if(preRow != null){
				preRow.removeClass("active");
			}
			$(this).addClass("active");
			preRow = $(this);
			templateId=$(this).find("td").eq(1).text();
			templatefile=$(this).find("td").eq(3).text();
			// 行单击后事件(传入行号，应用ID,应用名称信息)
			//rowClickAfter(rowIndex,
			//		$(this).find("td").eq(1).text(),
			//		$(this).find("td").eq(2).text());
		});
	</script>
</body>
</html>